-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update gammapy stat #318
Update gammapy stat #318
Conversation
tests will not pass until this is merged... |
lstchain/mc/sensitivity.py
Outdated
len(n_background) == n_bins_energy and | ||
len(alpha) == n_bins_energy): | ||
print("Excess, background and alpha arrays must have the same length") | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise ValueError
with that message, not print and return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe if any(len(a) != n_bins_energy for a in (n_excesses, n_background, alpha))
as a more concise formulation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, already implemented. The only problem with this (also present with my formulation) is that (n_excesses, n_background, alpha)
must be input as lists/arrays, and an error is raised if only single floats
are given as input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then apply np.asanyarray(n_on, ndmin=1)
to the input. If you also want to return a single number when the input were numbers, you can do sometehing like this:
scalar = np.isscalar(n_on)
n_on = np.asanyarray(n_on, ndmin=1)
n_off = ...
alpha = ...
...
if scalar:
return result[0]
return result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But let's get this merged first so the other PRs can run again
Due to the new version of gammapy (v0.17),
excess_matching_significance_on_off
function disappeared and now it is substituted by the following lines